﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cmsservice.Common.Memcached;

namespace cmsservice.Common
{
    public class Sms
    {
        public static void SendSms(string page,string method,string p)
        {
            try
            {
                string key = "cmsservice.Common.Sms.SendSms."+page+method;
                News2CacheTools cache = new News2CacheTools();
                var fhz= cache.Get<string>(key);
                if (fhz == "1")
                {
                    return;
                }
                string path = System.AppDomain.CurrentDomain.BaseDirectory + "App_Data/mobile.txt";
                string[] mobiles = File.ReadAllLines(path);
                var service = ServiceFactory.CreateEmoneybusinessService();
                foreach (var m in mobiles)
                {
                    try
                    {
                        string content = "页面" + page + "方法" + method + "参数" + p+"报错";
                        service.Send_Information_Summary_208(m, content, 1, "网站预警");
                        cache.Add(key, "1", 0, 10, 0);
                    }
                    catch (Exception ex)
                    {

                    }
                }
            }
            catch
            {
            }

        }
    }
}
